﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Koala.Pro.Common
{
    public class ServiceLocator
    {
        public static IServiceProvider SerivcePovider { get; private set; }

        public static void ConfigService(IServiceProvider provider)
        {
            SerivcePovider = provider;
        }

        public static T GetService<T>()
        {
            return SerivcePovider.GetService<T>();
        }

        public static object GetRequiredService(Type type)
        {
            return SerivcePovider.GetRequiredService(type);
        }
    }

}
